package com.bjc.scheduler.elasticjob.quickstart.demo;


import java.time.LocalDateTime;
import java.util.Timer;
import java.util.TimerTask;

/**
 * @program: elastic-job-quickstart
 * @description: Timer实现定时任务
 * @author: bjc
 * @create: 2021-08-15 19:13
 */
public class SimpleDemo2 {

    public static void main(String[] args) {
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                //TODO : something
                System.out.printf("time：%s to do something", LocalDateTime.now());
                System.out.println();
            }
            //1秒后开始调度，每2秒执行一次
        },1000,2000);
    }
}
